package com.example.administrator.xxnapp;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

import com.gyf.barlibrary.BarHide;
import com.gyf.barlibrary.ImmersionBar;

import butterknife.ButterKnife;
import cn.mdruby.baselibrary.BaseAppCompatActivity;
import cn.mdruby.baselibrary.utils.ABAppUtil;

/**
 * Created by Went_Gone on 2018/1/8.
 */
public abstract class BaseActivity extends BaseAppCompatActivity{
    protected Context mContext;
    protected ImmersionBar mImmersionBar;
    protected int page = 1;
    protected int pageSize = 15;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        mContext = this;
        mImmersionBar = ImmersionBar.with(this);
        super.onCreate(savedInstanceState);
        initBar();
    }

    protected void initBar() {
//        Toast.makeText(mContext, "==", Toast.LENGTH_SHORT).show();
        mImmersionBar.statusBarColor(R.color.base_color);
        if (ABAppUtil.checkDeviceHasNavigationBar(this)){
            mImmersionBar.navigationBarColor(R.color.white);
        }else {
            mImmersionBar.navigationBarEnable(false);
            mImmersionBar.hideBar(BarHide.FLAG_HIDE_NAVIGATION_BAR);
        }
        mImmersionBar.init();
    }

    @Override
    public void initViews() {
        initView();
    }

    public abstract void initView();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mImmersionBar != null)
            mImmersionBar.destroy();  //在BaseActivity里销毁
    }
}